package com.guancloud.gradesheet.action;

import java.io.FileInputStream;

import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;

public class ReadExcel {
	public static void main(String[] args) throws Exception {
		// create a file input stream object
		FileInputStream is = new FileInputStream("readExcel.xls");
		// create a POI file-system object
		POIFSFileSystem ts = new POIFSFileSystem(is);
		// get document object
		HSSFWorkbook wb = new HSSFWorkbook(ts);
		// get sheet object
		HSSFSheet sheet = wb.getSheetAt(0);
		// row object
		HSSFRow row = null;
		for(int i=0; sheet.getRow(i)!=null; i++) {
			row = sheet.getRow(i);
			// get every cell
			for (int j = 0; row.getCell(j)!=null; j++) {
				System.out.print(row.getCell(j).toString()+" ");
			}
			System.out.println();
		}
		is.close();
	}
}
